package reflect;

import reflect.annotations.AutoRunClass;

import java.lang.reflect.Field;
import java.util.Arrays;
//暴力反射
public class ReflectDemo12 {

    public static void main(String[] args) throws Exception {
        String s1="123abc";
        String s2="123abc";
        System.out.println("s1:"+s1);
        System.out.println("s2:"+s2);
        System.out.println("s1==s2:"+s1==s2);
        Class cls=String.class;
        Field field=cls.getDeclaredField("value");
        field.setAccessible(true);
        char[]value=(char[])field.get(s1);
        System.out.println(Arrays.toString(value));
        value=new char[]{'h','e','l','l','o'};
        field.set(s1,value);
        System.out.println("s1:"+s1);
        System.out.println("s2:"+s2);
        String s3=new String("123abc");
        System.out.println("s3:"+s3);
    }
}
